import request from '@/utils/request'

// 查询储位资料列表
export function listStorage(query) {
  return request({
    url: '/repertory/Storage/list',
    method: 'get',
    params: query
  })
}

// 查询储位资料详细
export function getStorage(storageId) {
  return request({
    url: '/repertory/Storage/' + storageId,
    method: 'get'
  })
}

// 新增储位资料
export function addStorage(data) {
  return request({
    url: '/repertory/Storage',
    method: 'post',
    data: data
  })
}

// 修改储位资料
export function updateStorage(data) {
  return request({
    url: '/repertory/Storage',
    method: 'put',
    data: data
  })
}

// 删除储位资料
export function delStorage(storageId) {
  return request({
    url: '/repertory/Storage/' + storageId,
    method: 'delete'
  })
}

// 导出储位资料
export function exportStorage(query) {
  return request({
    url: '/repertory/Storage/export',
    method: 'get',
    params: query
  })
}
//修改状态
export function changedStorageFlag(storageId, storageFlag, storageCode) {

  const data = {
    storageId,
    storageFlag,
    storageCode
  }
  return request({
    url: '/repertory/Storage/changeFlag',
    method: 'put',
    data: data
  })
}

export function getAll() {
  return request({
    url: '/repertory/Storage/getAllStr',
    method: 'get',
  })
}
export function getstorageType(flag) {
  return request({
    url: '/repertory/Storage/getstorageType/' + flag,
    method: 'get',
  })
}

export function locationWarehouse(query) {
  return request({
    url: '/repertory/locationWarehouse/list',
    method: 'get',
    params: query
  })
}
export function listByStorageCode(query) {
  return request({
    url: '/repertory/locationWarehouse/listByStorageCode',
    method: 'get',
    params: query
  })
}

// 新增库位资料
export function addlocationWarehouse(data) {
  return request({
    url: '/repertory/locationWarehouse',
    method: 'post',
    data: data
  })
}

export function getStorageBl(flag) {
  return request({
    url: '/repertory/Storage/getStorageBl/' + flag,
    method: 'get',
  })
}
export function getFinishedOrSemiFinishedProduct() {
  return request({
    url: '/repertory/Storage/getFinishedOrSemiFinishedProduct',
    method: 'get',
  })
}
